Skip to content

Accept optional kind: field in detection patterns (#54)#70

Merged
JuanVqz merged 1 commit intomainfrom
feature/validate-patterns-kind-field
May 4, 2026
Merged

Accept optional kind: field in detection patterns (#54)#70
JuanVqz merged 1 commit intomainfrom
feature/validate-patterns-kind-field

Conversation

@JuanVqz
Copy link
Copy Markdown
Member

@JuanVqz JuanVqz commented May 4, 2026

Summary

First step of the issue #53 rollout: extend bin/validate-patterns to recognize a new kind: field on every detection pattern entry, with enum validation against four allowed values (breaking, deprecation, migration, optional). Document the rubric for assigning kind: in CLAUDE.md alongside the existing priority rubric.

The field is optional during the rollout — every existing pattern file still validates clean — and the validator already rejects unknown values to guard against typos. After all 12 pattern files have been classified (sub-issues #55 through #66), #67 flips the validator to require kind:.

Why

priority (HIGH/MEDIUM/LOW) describes urgency. kind describes what the change is. They're orthogonal: a HIGH deprecation (silently wrong, like DIRTY_TRACKING_AFTER_SAVE) and a HIGH breaking (won't boot) are both "fix first" but for different reasons. Surfacing kind in detection output later (#69) lets users distinguish "fix before bump" (breaking) from "fix when ready" (deprecation / migration / optional). Today, every pattern is grouped under breaking_changes: regardless of what it actually is — a misnomer that loses signal. Background: #43 review thread and the audit in #53.

Changes

  • bin/validate-patterns: add KIND_VALUES enum, validate kind per entry when present.
  • CLAUDE.md: update tooling notes to mention the kind: enum check; add ## Assigning kind: section with semantics + decision rubric for the four values.
  • rails-upgrade/CHANGELOG.md: Unreleased entry.

Test plan

  • bin/validate-patterns passes on all 12 existing pattern files (no kind: set anywhere yet)
  • Synthetic fixture with kind: "breaking" validates clean
  • Synthetic fixture with kind: "bogus" fails with: invalid kind: "bogus" (allowed: breaking, deprecation, migration, optional)
  • Exit code 1 on the failing fixture

Linked issues

Extends bin/validate-patterns to recognize a `kind:` field on every
pattern entry, with enum validation against four allowed values:
`breaking`, `deprecation`, `migration`, `optional`. The validator
rejects unknown values (typo guard) but does not require the field
yet — existing pattern files keep validating clean.

Documents the four values and assignment rubric in CLAUDE.md, alongside
the existing priority rubric. priority and kind are orthogonal: a HIGH
deprecation (silently wrong) and a HIGH breaking (won't boot) are both
"fix first" but for different reasons.

First step of the issue #53 rollout. Subsequent classification PRs will
add `kind:` per pattern, version-by-version. After all 12 pattern files
are classified, the validator will be tightened to require kind.

Refs #53, closes #54
Comment thread bin/validate-patterns
TOP_LEVEL_KEYS = %w[version description breaking_changes].freeze
PATTERN_KEYS = %w[name pattern exclude search_paths explanation fix variable_name].freeze
PRIORITY_KEYS = %w[high_priority medium_priority low_priority].freeze
KIND_VALUES = %w[breaking deprecation migration optional].freeze
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the kind keyword is going to be required after the transition is finished.

@JuanVqz
Copy link
Copy Markdown
Member Author

JuanVqz commented May 4, 2026

Code-reviewed end-to-end with Claude. Ready for human review.

@JuanVqz JuanVqz merged commit 9dcc14e into main May 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Schema: extend bin/validate-patterns to accept kind: field

1 participant